﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using TamTreSoSinh.DBContext;

namespace TamTreSoSinh
{
    public partial class ServiceDetailPage : System.Web.UI.Page
    {
        protected void Page_Load(object sender, EventArgs e)
        {
            int Id;
            bool isValidId = int.TryParse(Request["Id"], out Id);
            if (!isValidId)
            {
                return;
            }

            LoadOurService(Id);
        }

        private void LoadOurService(int Id)
        {
            DBTamTreEntities datacontext = new DBTamTreEntities();
            OurService ourService = datacontext.OurServices.FirstOrDefault(obj => obj.Id == Id);
            if (ourService == null)
            {
                return;
            }

            lblTitle.Text = ourService.Title;
            lblOverview.Text = ourService.Overview;
            ltrContent.Text = ourService.ServiceContent;
        }
    }
}